#pragma once

#include "Ship.h"
#include "IwUtil.h"

#define MAX_LEVEL_COUNT 20

class ScoreStorage : public CIwManaged {
	public:
	IW_MANAGED_DECLARE(ScoreStorage);
	
	void Serialise();
	
	int32 m_current_level;
	int32 highscores[MAX_LEVEL_COUNT];
};

class ScoreSystem {
	public:
	
		// load the current highscores
		void Load();
		
		// save the highscores to disk
		void Save();
	
		// @ship, the ship which is now unloaded
		void ShipUnloadingFinished( const Ship& ship );
		
		void FinishedLevel();
		
		int GetCurrentLevel() const;
		
		void SetupDefaults();
		
		// start a new score section for the level with
		// the provided id
		void StartNew( int id );
		int GetCurrentScore() const;
		int GetCurrentHighscore() const;
		
		// IMPORTANT: this function returns true only once
		// after the game received the new highscore info once
		// it will continue to return false
		bool ReachedNewHighscore_once();
	
	private:
	
		ScoreStorage m_scores;
	
		
		int m_current_score;
};